# Maintainer: Felix Yan <felixonmars@archlinux.org>
# Contributor: Josip Ponjavic <josipponjavic at gmail dot com>
# Contributor: Xu Fasheng <fasheng.xu[AT]gmail.com>

pkgname=deepin-screen-recorder
pkgver=5.11.15
_commit=8ef647a6c8affee317a91517afaa0f64353aca6d
pkgrel=2
pkgdesc='Deepin Screen Recorder'
arch=('loong64' 'x86_64')
url="https://github.com/linuxdeepin/deepin-screen-recorder"
license=('GPL3')
depends=('deepin-qt5integration' 'deepin-turbo' 'ffmpeg' 'libxtst' 'opencv' 'portaudio' 'deepin-image-editor')
makedepends=('git' 'deepin-dock')
optdepends=('deepin-shortcut-viewer: for shortcut display')
provides=('deepin-screenshot')
conflicts=('deepin-screenshot')
groups=('deepin-extra')
source=("git+https://github.com/linuxdeepin/deepin-screen-recorder.git#commit=$_commit")
sha512sums=('SKIP')

prepare() {
  cd deepin-screen-recorder

  # https://github.com/linuxdeepin/developer-center/issues/3035
  sed -i "s|/etc/os-version|/etc/uos-version|" src/src.pro

  # OpenCV 4 compatibility
  sed -i '/#include<opencv2/i #include <opencv2/imgproc/types_c.h>' src/utils/pixmergethread.h

  # OpenCV missing in pkg-config targets
  sed -i 's/dframeworkdbus/dframeworkdbus opencv4/' src/src.pro
}

build(){
  cd deepin-screen-recorder
  qmake-qt5 PREFIX=/usr
  make
}

package() {
  cd deepin-screen-recorder
  make INSTALL_ROOT="$pkgdir" install
}
